import ssh_session

def runssh(cmd,host,user,password,port = None):
	o = ssh_session.ssh_session(user,host,password,0)
	ret = o.ssh(cmd)
	return ret
def runscp(scp,host,user,password,port = None):
	o = ssh_session.ssh_session(user,host,password,0)
	ret = o.scp(scp)
	return ret
def runscp2(src,dst,host,user,password,port = None):
	o = ssh_session.ssh_session(user,host,password,0)
	ret = o.scp2(src,dst)
	return ret


if __name__ == "__main__":
	import sys
	HOST = sys.argv[1]
	USER = sys.argv[2]
	PASSWORD = sys.argv[3]
	ret =  runssh("nohup /Library/Frameworks/Python.framework/Versions/Current/bin/python svn/pyposnet-read-only/src/posnet_server.py 22000",host=HOST, user=USER, password=PASSWORD)
	print ret
	ret  = runssh( "ps aux | grep python", host=HOST, user=USER, password=PASSWORD)
	print ret
	#ret = runssh("echo 'toto' > titi ", host=HOST, user=USER, password=PASSWORD)
	#ret = runscp2("titi","tutu", host=HOST, user=USER, password=PASSWORD)
	#print file("tutu","r").read()
